package bean;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;



/**
 * Hotel generated by hbm2java
 */
@Entity
@Table(name = "hotel", catalog = "bdd_dev_n_tiers")
public class Hotel implements java.io.Serializable {

	private Integer id;
	private String name;
	private String address;
	private String classification;
	private Set<Flight> flights = new HashSet<Flight>(0);

	public Hotel() {
	}

	public Hotel(String name, String address, String classification) {
		this.name = name;
		this.address = address;
		this.classification = classification;
	}

	public Hotel(String name, String address, String classification, Set<Flight> flights) {
		this.name = name;
		this.address = address;
		this.classification = classification;
		this.flights = flights;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", nullable = false, length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "address", nullable = false, length = 50)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "classification", nullable = false, length = 50)
	public String getClassification() {
		return this.classification;
	}

	public void setClassification(String classification) {
		this.classification = classification;
	}

	@JsonIgnore
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "assoc_flight_hotel", catalog = "bdd_dev_n_tiers", joinColumns = { @JoinColumn(name = "id_hotel", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "id_flight", nullable = false, updatable = false) })
	public Set<Flight> getFlights() {
		return this.flights;
	}

	public void setFlights(Set<Flight> flights) {
		this.flights = flights;
	}

}
